home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / tde210.zip / TDECFG.H < prev    next >
C/C++ Source or Header  |  1992-11-13  |  16KB  |  486 lines

  1. /********    EXTREMELY IMPORTANT   ************/
  2. /*
  3.  * If you modify tde, it is your responsibility to find the offset of
  4.  * the key definition array in your new executable, tde.exe.
  5.  *
  6.  */
  7.  
  8. #define  COLOR_OFFSET   106824l
  9. #define  HELP_OFFSET    104721l
  10. #define  KEYS_OFFSET    103798l
  11. #define  MACRO_OFFSET   98886l
  12. #define  MODE_OFFSET    98306l
  13. #define  SORT_OFFSET    97794l
  14.  
  15. /********    EXTREMELY IMPORTANT   ************/
  16.  
  17.  
  18. #define TRUE            1
  19. #define FALSE           0
  20.  
  21. #define OK              0
  22. #define ERROR           (-1)
  23.  
  24.  
  25. #define MAX_KEYS        256
  26. #define AVAIL_KEYS      233
  27.  
  28.  
  29. #define STROKE_LIMIT    1024
  30.  
  31.  
  32. #define NUM_FUNC        132
  33.  
  34. #define NUM_COLORS      12
  35.  
  36. #define NUM_MODES       22
  37.  
  38. /*
  39.  * mode indexes
  40.  */
  41. #define Ins              0
  42. #define Ind              1
  43. #define PTAB             2
  44. #define LTAB             3
  45. #define Smart            4
  46. #define Write_Z          5
  47. #define Crlf             6
  48. #define Trim             7
  49. #define Eol              8
  50. #define WW               9
  51. #define Left            10
  52. #define Para            11
  53. #define Right           12
  54. #define Size            13
  55. #define Backup          14
  56. #define Ruler           15
  57. #define Date            16
  58. #define Time            17
  59. #define Initcase        18
  60. #define InflateTabs     19
  61. #define Match           20
  62. #define Ignore          21
  63.  
  64.  
  65.  
  66. #define EXIST           0
  67.  
  68. #define VIDEO_INT       0x10
  69.  
  70. #define VGA             3
  71. #define EGA             2
  72. #define CGA             1
  73. #define MDA             0
  74.  
  75. #define NORMAL          7
  76. #define COLOR_ATTR      31
  77. #define MONO_ATTR       112
  78.  
  79.  
  80. #define ESC             27
  81. #define LEFT            (75 | 0x100)
  82. #define RIGHT           (77 | 0x100)
  83. #define UP              (72 | 0x100)
  84. #define DOWN            (80 | 0x100)
  85. #define RTURN           13
  86. #define PGUP            (73 | 0x100)
  87. #define PGDN            (81 | 0x100)
  88. #define F1              (59 | 0x100)
  89. #define F2              (60 | 0x100)
  90. #define F3              (61 | 0x100)
  91. #define F5              (63 | 0x100)
  92. #define F6              (64 | 0x100)
  93. #define F7              (65 | 0x100)
  94. #define F8              (66 | 0x100)
  95. #define F10             (68 | 0x100)
  96.  
  97.  
  98. #define U_LEFT          218
  99. #define U_RIGHT         191
  100. #define VER_LINE        179
  101. #define HOR_LINE        196
  102. #define L_LEFT          192
  103. #define L_RIGHT         217
  104.  
  105. #define SAVE            0
  106. #define RESTORE         1
  107.  
  108.  
  109. /*
  110.  * Save the underlying text of the screen in a structure.  We need to know
  111.  * the column and row to begin saving the text.  Since we are doing an
  112.  * optimal save and restore, we don't know how much memory to allocate to
  113.  * the save buffer.  If we use a pointer, then we can dynamically allocate as
  114.  * much or as little memory as we need.  Finally, we need a window pointer
  115.  * to point to the next item on the stack.
  116.  */
  117. typedef struct win {
  118.    int x;
  119.    int y;
  120.    int *buf;
  121.    struct win *n;
  122. } WINDOW;
  123.  
  124.  
  125. /*
  126.  * Structure to store the row and column of a string.
  127.  */
  128. struct screen {
  129.    unsigned int   row;
  130.    unsigned int   col;
  131.    unsigned char *text;
  132. };
  133.  
  134.  
  135. /*
  136.  * video adapter stuff.
  137.  */
  138. struct vcfg {
  139.    int color;
  140.    int rescan;
  141.    int mode;
  142.    int adapter;
  143.    int attr;
  144.    int far *videomem;
  145. };
  146.  
  147.  
  148. /*
  149.  * When we display a pop-up or pull-down window, we need to know a few things
  150.  * about the window and the text to display in the window.
  151.  */
  152. typedef struct {
  153.    int dply_col;        /* offset into window to begin displaying help list */
  154.    int dply_row;        /* dito */
  155.    int line_length;     /* the length of the help line in the window */
  156.    int avail_lines;     /* number of lines in the window available for list */
  157.    int v_row;           /* virtual row of cursor in window */
  158.    int select;          /* item currently selected in help list */
  159.    int num_entries;     /* total number of items in help list */
  160.    int ulft_col;        /* absolute upper left column of window */
  161.    int ulft_row;        /* absolute upper left row of window */
  162.    int total_col;       /* total number of columns in window */
  163.    int total_row;       /* total number of rows in window */
  164. } HELP_WINDOW;
  165.  
  166.  
  167. /*
  168.  * structure for list of available keys.   See default.h for more info.
  169.  */
  170. typedef struct {
  171.    char *key;           /* key name */
  172.    int  key_index;      /* offset into key structure in tde.exe file */
  173.    unsigned char func_index;     /* function of key */
  174. } KEY_DEFS;
  175.  
  176.  
  177. /*
  178.  * structure for list of available keys.   See default.h for more info.
  179.  */
  180. typedef struct {
  181.    char *key;           /* key name */
  182.    int  key_index;      /* offset into key structure in tde.exe file */
  183. } CONFIG_DEFS;
  184.  
  185.  
  186. /*
  187.  * From the source code of tde.
  188.  */
  189. typedef struct {
  190.   int key;      /* key assinged to this node, which may be text or function */
  191.   int next;     /* pointer to next node in macro def */
  192. } STROKES;
  193.  
  194. /*
  195.  * structure for the macro buffer.
  196.  */
  197. typedef struct {
  198.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  199.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  200. } MACRO;
  201.  
  202.  
  203.  
  204. /*
  205.  * "mode_infos" contain the editor mode variables.  The configuration
  206.  *  utility modifies this structure to custimize the start-up tde
  207.  *  configuration
  208.  */
  209. typedef struct {
  210.    int  color_scheme;           /* color to start out with */
  211.    int  sync;                   /* sync the cursor movement command? */
  212.    int  sync_sem;               /* sync the cursor movement command? */
  213.    int  record;                 /* are we recording keystrokes? */
  214.    int  insert;                 /* in insert mode? */
  215.    int  indent;                 /* in auto-indent mode? */
  216.    int  ptab_size;              /* physical tab stops */
  217.    int  ltab_size;              /* logical tab stops */
  218.    int  smart_tab;              /* smart tab mode on or off? */
  219.    int  inflate_tabs;           /* inflate tabs?  T or F */
  220.    int  search_case;            /* consider case? IGNORE or MATCH */
  221.    int  enh_kbd;                /* type of keyboard */
  222.    int  cursor_size;            /* insert cursor big or small? */
  223.    char *eof;                   /* message to display at end of file */
  224.    int  control_z;              /* write ^Z - t or f */
  225.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  226.    int  trailing;               /* remove trailing space? T or F */
  227.    int  show_eol;               /* show lf at eol? T or F */
  228.    int  word_wrap;              /* in word wrap mode? */
  229.    int  left_margin;            /* left margin */
  230.    int  parg_margin;            /* column for 1st word in paragraph */
  231.    int  right_margin;           /* right margin */
  232.    int  do_backups;             /* create backup or ".bak" files? T or F */
  233.    int  ruler;                  /* show ruler at top of window? T or F */
  234.    int  date_style;             /* date style for date and time stamp */
  235.    int  time_style;             /* time style for date and time stamp */
  236. } MODE_INFO;
  237.  
  238.  
  239. typedef struct {
  240.    unsigned char ignore[256];
  241.    unsigned char match[256];
  242. } SORT_ORDER;
  243.  
  244.  
  245. /*************  prototypes for functions in  tdecfg.c  *******************/
  246. void  main( int, char *[] );
  247. void xygoto( int, int );
  248. void video_config( void );
  249. int getkey( void );
  250. void s_output( char far *, int, int, int );
  251. void cls( void );
  252. void hlight_line( int, int, int, int );
  253. void c_off( void );
  254. void c_on( void );
  255. void scroll_window( int, int, int, int, int, int );
  256. void cls( void );
  257. void show_box( int, int, struct screen *, int );
  258. void make_window( int, int, int, int, int );
  259. void buf_box( int, int, int, int, int );
  260. void clear_window( int, int, int, int );
  261. void window_control( WINDOW **, int, int, int, int, int );
  262. void save_window( int *, int, int, int, int );
  263. void restore_window( int *, int, int, int, int );
  264. /*************************************************************************/
  265.  
  266.  
  267. /*************  prototypes for functions in  cfgcolor.c  *****************/
  268. void tdecolor( void );
  269. void initialize_color( void );
  270. void show_init_sample( void );
  271. void color_number( char *, int );
  272. void current_color_number( char *, int );
  273. void show_help_color( void );
  274. void show_fileheader_color( void );
  275. void show_text_color( void );
  276. void show_curl_color( void );
  277. void show_warning_color( void );
  278. void show_mode_color( void );
  279. void show_wrapped_color( void );
  280. void show_eof_color( void );
  281. void show_ruler_color( void );
  282. void show_rulerptr_color( void );
  283. void show_block_color( void );
  284. void show_hilitedfile_color( void );
  285. void change_colors( void );
  286. /*************************************************************************/
  287.  
  288.  
  289. /*************  prototypes for functions in  cfgkeys.c  *****************/
  290. void tdekeys( void );
  291. void initialize_keys( void );
  292. void show_key_def_list( HELP_WINDOW *, KEY_DEFS * );
  293. void show_func_list( HELP_WINDOW *, char *[] );
  294. void position_cursor( HELP_WINDOW *, int, int *, int *, int * );
  295. void master_help( HELP_WINDOW *, KEY_DEFS *, struct screen *, char *, int * );
  296. void new_assignment_help( HELP_WINDOW *, char *[], struct screen *, int * );
  297. void save_and_draw( HELP_WINDOW *, struct screen *, WINDOW ** );
  298. /*************************************************************************/
  299.  
  300.  
  301. /*************  prototypes for function in  cfghelp.c  *******************/
  302. void tdehelp( void );
  303. /*************************************************************************/
  304.  
  305.  
  306. /*************  prototypes for function in  cfgmacro.c  *******************/
  307. void tdemacro( void );
  308. /*************************************************************************/
  309.  
  310.  
  311. /*************  prototypes for functions in cfgmodes.c  *****************/
  312. void tdemodes( void );
  313. void initialize_modes( void );
  314. void show_init_mode( void );
  315. void show_insert_mode( void );
  316. void show_indent_mode( void );
  317. void show_smart_mode( void );
  318. void show_ptabsize( void );
  319. void show_ltabsize( void );
  320. void show_controlz( void );
  321. void show_eol_out( void );
  322. void show_trail( void );
  323. void show_eol_display( void );
  324. void show_ww( void );
  325. void show_left( void );
  326. void show_para( void );
  327. void show_right( void );
  328. void show_cursor_size( void );
  329. void show_backup_mode( void );
  330. void show_ruler_mode( void );
  331. void show_date_style( void );
  332. void show_time_style( void );
  333. void show_initcase( void );
  334. void change_modes( void );
  335. /*************************************************************************/
  336.  
  337.  
  338. /*************  prototypes for functions in cfgfile.c    *****************/
  339. void tdecfgfile( void );
  340. void parse_line( char * );
  341. char *parse_token( char *, char * );
  342. int  search( char *, CONFIG_DEFS [], int );
  343. void parse_macro( int, char * );
  344. int  parse_literal( int, char *, char *, char ** );
  345. void initialize_macro( int );
  346. void clear_previous_macro( int );
  347. void check_macro( int );
  348. int  record_keys( int, int );
  349. void new_sort_order( unsigned char *, unsigned char * );
  350. int  get_stroke_count( void );
  351. int  getfunc( int );
  352. /*************************************************************************/
  353.  
  354.  
  355. #define   Help                     1
  356. #define   Rturn                    2
  357. #define   NextLine                 3
  358. #define   BegNextLine              4
  359. #define   LineDown                 5
  360. #define   LineUp                   6
  361. #define   CharRight                7
  362. #define   CharLeft                 8
  363. #define   PanRight                 9
  364. #define   PanLeft                 10
  365. #define   WordRight               11
  366. #define   WordLeft                12
  367. #define   ScreenDown              13
  368. #define   ScreenUp                14
  369. #define   EndOfFile               15
  370. #define   TopOfFile               16
  371. #define   BotOfScreen             17
  372. #define   TopOfScreen             18
  373. #define   EndOfLine               19
  374. #define   BegOfLine               20
  375. #define   JumpToLine              21
  376. #define   CenterWindow            22
  377. #define   CenterLine              23
  378. #define   HorizontalScreenRight   24
  379. #define   HorizontalScreenLeft    25
  380. #define   ScrollDnLine            26
  381. #define   ScrollUpLine            27
  382. #define   PanUp                   28
  383. #define   PanDn                   29
  384. #define   ToggleOverWrite         30
  385. #define   ToggleSmartTabs         31
  386. #define   ToggleIndent            32
  387. #define   ToggleWordWrap          33
  388. #define   ToggleCRLF              34
  389. #define   ToggleTrailing          35
  390. #define   ToggleZ                 36
  391. #define   ToggleEol               37
  392. #define   ToggleSync              38
  393. #define   ToggleRuler             39
  394. #define   ToggleTabInflate        40
  395. #define   SetTabs                 41
  396. #define   SetLeftMargin           42
  397. #define   SetRightMargin          43
  398. #define   SetParagraphMargin      44
  399. #define   FormatParagraph         45
  400. #define   FormatText              46
  401. #define   LeftJustify             47
  402. #define   RightJustify            48
  403. #define   CenterJustify           49
  404. #define   Tab                     50
  405. #define   BackTab                 51
  406. #define   ParenBalance            52
  407. #define   BackSpace               53
  408. #define   DeleteChar              54
  409. #define   StreamDeleteChar        55
  410. #define   DeleteLine              56
  411. #define   DelEndOfLine            57
  412. #define   WordDelete              58
  413. #define   AddLine                 59
  414. #define   SplitLine               60
  415. #define   JoinLine                61
  416. #define   DuplicateLine           62
  417. #define   AbortCommand            63
  418. #define   UndoLine                64
  419. #define   UndoDelete              65
  420. #define   ToggleSearchCase        66
  421. #define   FindForward             67
  422. #define   FindBackward            68
  423. #define   RepeatFindForward1      69
  424. #define   RepeatFindForward2      70
  425. #define   RepeatFindBackward1     71
  426. #define   RepeatFindBackward2     72
  427. #define   ReplaceString           73
  428. #define   DefineDiff              74
  429. #define   RepeatDiff              75
  430. #define   MarkBox                 76
  431. #define   MarkLine                77
  432. #define   MarkStream              78
  433. #define   UnMarkBlock             79
  434. #define   FillBlock               80
  435. #define   NumberBlock             81
  436. #define   CopyBlock               82
  437. #define   KopyBlock               83
  438. #define   MoveBlock               84
  439. #define   OverlayBlock            85
  440. #define   DeleteBlock             86
  441. #define   SwapBlock               87
  442. #define   BlockToFile             88
  443. #define   PrintBlock              89
  444. #define   BlockExpandTabs         90
  445. #define   BlockCompressTabs       91
  446. #define   BlockIndentTabs         92
  447. #define   BlockTrimTrailing       93
  448. #define   BlockUpperCase          94
  449. #define   BlockLowerCase          95
  450. #define   BlockRot13              96
  451. #define   BlockFixUUE             97
  452. #define   BlockEmailReply         98
  453. #define   BlockStripHiBit         99
  454. #define   SortBoxBlock           100
  455. #define   DateTimeStamp          101
  456. #define   EditFile               102
  457. #define   DirList                103
  458. #define   File                   104
  459. #define   Save                   105
  460. #define   SaveAs                 106
  461. #define   SetFileAttributes      107
  462. #define   EditNextFile           108
  463. #define   DefineSearchAndSeize   109
  464. #define   RepeatSearchAndSeize   110
  465. #define   RedrawScreen           111
  466. #define   SizeWindow             112
  467. #define   SplitHorizontal        113
  468. #define   SplitVertical          114
  469. #define   NextWindow             115
  470. #define   PreviousWindow         116
  471. #define   ZoomWindow             117
  472. #define   NextHiddenWindow       118
  473. #define   SetMark1               119
  474. #define   SetMark2               120
  475. #define   SetMark3               121
  476. #define   GotoMark1              122
  477. #define   GotoMark2              123
  478. #define   GotoMark3              124
  479. #define   RecordMacro            125
  480. #define   PlayBack               126
  481. #define   SaveMacro              127
  482. #define   LoadMacro              128
  483. #define   ClearAllMacros         129
  484. #define   Pause                  130
  485. #define   Quit                   131
  486.